<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<c:set var="site" value="index" scope="application"/>
<html>
    <c:import url="module/jsp/head.jsp"/>
    <body>
        <c:import url="module/jsp/header.jsp"/>
        <c:import url="module/jsp/aside.jsp"/>
        <main>
            <div class="main-content">
                <div class="welcome"> 您好，欢迎您访问明刻博客！ </div>
                <div class="picbox">
                    <h2 class="pictitle"><a href="/">推荐</a></h2>
                    <!--box begin-->
                    <div class="Box_con"> <span class="btnl btn" id="btnl"></span> <span class="btnr btn" id="btnr"></span>
                        <div class="conbox" id="BoxUl">
                            <ul>
                                <c:forEach items="${chapterList}" var="chapter">
                                <li class="cur">
                                    <a href="${pageContext.request.contextPath}/info?id=${chapter.id}">
                                        <img src="${chapter.imgUrl}" alt="${chapter.title}" />
                                        <p>${chapter.title}</p>
                                    </a>
                                </li>
                                </c:forEach>
                            </ul>
                        </div>
                    </div>
                    <!--box end-->
                </div>
                <div class="newsbox">
                    <c:forEach items="${categorylist}" var="category">
                        <section>
                            <div class="news">
                                <h2 class="newstitle"><span><a href="${pageContext.request.contextPath}/list?categoryId=${category.id}">更多</a></span><b>${category.name}</b></h2>
                                <ul>
                                    <c:forEach items="${category.chapterList}" var="chapter">
                                    <li>
                                        <a href="${pageContext.request.contextPath}/info?id=${chapter.id}">
                                            <span>
                                                <jsp:useBean id="timestamp" class="java.util.Date"/>
                                                <jsp:setProperty name="timestamp" property="time" value="${chapter.gmtCreate *1000}"/>
                                                <fmt:formatDate value="${timestamp}" pattern="yyyy-MM-dd"/>
                                            </span>
                                                ${chapter.title}
                                        </a>
                                    </li>
                                    </c:forEach>
                                </ul>
                            </div>
                        </section>
                    </c:forEach>
                </div>
                <div class="blank"></div>
                <c:import url="module/jsp/footer.jsp"/>
            </div>
        </main>
        <a href="#" class="cd-top cd-is-visible">Top</a>
    </body>
    <c:import url="module/jsp/js.jsp"/>
</html>
